/*
 * FileName: 简历主页面（主要用来控制显示新增编辑还是列表预览）
 * Created Date: 2022-10-19 17:29:19
 * Author: 文初阳
 * -----
 * Last Modified: 2022-10-19 17:29:19
 * Modified By: 文初阳
 */

import React, { useState } from 'react';
import { ResumeContext, TPageName } from '../states/resume';
import Edit from './edit/Edit';
import List from './list/List';
import Preview from './preview/Preview';

const ResumePage: React.FC = () => {
    const [pageName, setPageName] = useState<TPageName>('list');

    return (
        <ResumeContext.Provider value={{ pageName, setPageName }}>
            {(() => {
                if (pageName === 'edit' || pageName === 'add') return <Edit />;
                if (pageName === 'preview') return <Preview />;
                return <List />;
            })()}
        </ResumeContext.Provider>
    );
};

export default ResumePage;
